SHELL = @SHELL@
srcdir = @srcdir@
VPATH = @srcdir@
PLATFORM_DIR = $(srcdir)/..
CC = @CC@
.SUFFIXES:
.SUFFIXES: .c .o

PKG_CONFIG = @PKG_CONFIG@
LIBS = @LIBS@ @LFS_LDFLAGS@ -lICE -lSM -lm -ldl
#PROF = -fprofile-arcs -pg

CFLAGS = -I. -I${srcdir} ${PROF} @CFLAGS@ @LFS_CFLAGS@ \
	 `${PKG_CONFIG} --cflags gtk+-2.0 libxml-2.0`
LDFLAGS = ${PROF} @LDFLAGS@ `${PKG_CONFIG} --libs gtk+-2.0 libxml-2.0 | sed 's/-lpangoxft-[^ ]*//'` ${LIBS}
EXEC = ${PLATFORM_DIR}/${PROG}

############ Things to change for different programs

PROG = ROX-Filer

SRCS = abox.c action.c appinfo.c appmenu.c bind.c bookmarks.c		\
	bulk_rename.c cell_icon.c choices.c collection.c dir.c 		\
	diritem.c display.c dnd.c dropbox.c filer.c find.c fscache.c	\
	gtksavebox.c							\
	gui_support.c i18n.c icon.c infobox.c main.c menu.c minibuffer.c\
	modechange.c mount.c options.c panel.c pinboard.c pixmaps.c	\
	remote.c rox_gettext.c run.c sc.c session.c support.c 		\
	tasklist.c toolbar.c type.c usericons.c view_collection.c	\
	view_details.c view_iface.c wrapped.c xml.c xtypes.c \
	xdgmime.c xdgmimeglob.c xdgmimeint.c xdgmimemagic.c xdgmimeparent.c xdgmimealias.c xdgmimecache.c 

OBJECTS = abox.o action.o appinfo.o appmenu.o bind.o bookmarks.o	\
	bulk_rename.o cell_icon.o choices.o collection.o dir.o		\
	diritem.o display.o dnd.o dropbox.o filer.o find.o fscache.o	\
	gtksavebox.o							\
	gui_support.o i18n.o icon.o infobox.o main.o menu.o minibuffer.o\
	modechange.o mount.o options.o panel.o pinboard.o pixmaps.o	\
	remote.o rox_gettext.o run.o sc.o session.o support.o		\
	tasklist.o toolbar.o type.o usericons.o view_collection.o	\
	view_details.o view_iface.o wrapped.o xml.o xtypes.o \
	xdgmime.o xdgmimeglob.o xdgmimeint.o xdgmimemagic.o xdgmimeparent.o xdgmimealias.o xdgmimecache.o

############ Things to keep the same

${PROG}: ${OBJECTS}
	${CC} -o "${PROG}" ${OBJECTS} ${LDFLAGS}
	mv "${PROG}" "${PLATFORM_DIR}"
	-(cd "${PLATFORM_DIR}" && \
	 objcopy --only-keep-debug ROX-Filer ROX-Filer.dbg && \
	 strip ROX-Filer && \
	 objcopy --add-gnu-debuglink=ROX-Filer.dbg ROX-Filer)

clean:
	rm -f *.o Makefile.bak

depend:
	makedepend -- ${CFLAGS} -- ${SRCS}

Makefile: Makefile.in config.status
	./config.status

config.h: config.h.in
	./config.status

config.status: configure
	APP_DIR="$(srcdir)/.." $(srcdir)/configure

configure: configure.in
	cd $(srcdir) && autoconf
